home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / 96000tar.z / 96000tar / 96000 / master2.asm < prev    next >
Assembly Source File  |  1992-04-28  |  10KB  |  188 lines

  1.           page   132,65,3,3
  2. ;         opt       CC
  3. ;********************************************************
  4. ;*    Motorola Austin DSP Operation  10 April 1991      *
  5. ;*                                                      *
  6. ;*  COPYRIGHT (C) BY MOTOROLA INC, ALL RIGHTS RESERVED  *
  7. ;*                                                      *
  8. ;*      ALTHOUGH THE INFORMATION CONTAINED HEREIN,      *
  9. ;*      AS WELL AS ANY INFORMATION PROVIDED RELATIVE    *
  10. ;*      THERETO, HAS BEEN CAREFULLY REVIEWED AND IS     *
  11. ;*      BELIEVED ACCURATE, MOTOROLA ASSUMES NO          *
  12. ;*      LIABILITY ARISING OUT OF ITS APPLICATION OR     *
  13. ;*      USE, NEITHER DOES IT CONVEY ANY LICENSE UNDER   *
  14. ;*      ITS PATENT RIGHTS NOR THE RIGHTS OF OTHERS.     *
  15. ;*                                                      *
  16. ;********************************************************
  17.  
  18. ;****************************************************************************
  19. ;   master2.asm  - demo code for DSP96002 multi-device simulation
  20. ;
  21. ;   9 April 91: Roman Robles - polish for 4 dev. sim.
  22. ;
  23. ;   relavant topology for this simulation:
  24. ;
  25. ;                       B       A          B       A
  26. ;             ----------+       +----------+       +-----------
  27. ;              Upstream |       |  Master  |       |   Slave   
  28. ;              DSP96002 |=====> | DSP96002 |=====> |  DSP96002 
  29. ;             __________|(PIO)  |__________| (DMA) |___________
  30. ;
  31. ;****************************************************************************
  32. ; Equates Section
  33. ;****************************************************************************
  34.  
  35. RESET   equ     $00000000               ; reset isr
  36. DMA0    equ     $00000010               ; DMA channel 0 isr
  37. MAIN    equ     $00000200               ; main routine
  38.  
  39. IPR     equ     $FFFFFFFF               ; interrupt priority reg
  40. BCRA    equ     $FFFFFFFE               ; port a bus control reg
  41. BCRB    equ     $FFFFFFFD               ; port b bus control reg
  42. PSR     equ     $FFFFFFFC               ; port select reg
  43.  
  44. ;****************************************************************************
  45. ; Addresses of Host's DMA Channel 0 Registers
  46. ;****************************************************************************
  47.  
  48. DMA0SAR equ     $FFFFFFDE               ; DMA ch 0 source address reg
  49. DMA0SOR equ     $FFFFFFDD               ; DMA ch 0 source offset reg
  50. DMA0CR  equ     $FFFFFFDC               ; DMA ch 0 counter reg
  51. DMA0DAR equ     $FFFFFFDA               ; DMA ch 0 destination address reg
  52. DMA0CSR equ     $FFFFFFD8               ; DMA ch 0 control/status reg
  53.  
  54. ;****************************************************************************
  55. ; Addresses of Slave's Port A Host Interface Registers
  56. ;****************************************************************************
  57.  
  58. SLAVEADDR equ   $FFFFFFC0               ; base address of slave host port reg
  59. XMR       equ   SLAVEADDR+$C            ; direct address X memory read
  60. HICSR     equ   SLAVEADDR+$20           ; slave host int control/status reg
  61. RX        equ   SLAVEADDR+$28           ; receive reg
  62. TX        equ   SLAVEADDR+$28           ; transmit reg
  63. CVR       equ   SLAVEADDR+$34           ; command vector reg
  64.  
  65.  
  66. ;****************************************************************************
  67. ; Addresses of Upstream DSP's Port B Host Interface Registers
  68. ;****************************************************************************
  69.  
  70. UpstrADDR equ   $20000000               ; base address of upstr host port reg
  71. UHICSR    equ   UpstrADDR+$20           ; Upstr host int control/status reg
  72. URX       equ   UpstrADDR+$28           ; receive reg
  73.  
  74.  
  75. RXDF    equ   0                         ; receiver data full bit 0 in
  76.                                         ;   interrupt control/status reg
  77. TRDY    equ   2                         ; transmitter ready bit
  78.                                         ;   2 in interrupt control/status reg
  79. INIT    equ   6                         ; initialize bit 6 in the interrupt
  80.                                         ;   control/status reg
  81. HMRC    equ   15                        ; host memory read command bit 15
  82.                                         ;   in interrupt control/status reg
  83. HC      equ   15                        ; host command bit 15 in the command
  84.                                         ;   vector register
  85. DE      equ   31                        ; DMA channel enable control bit 
  86.                                         ;   31 in DMA control/status reg
  87.  
  88. ;****************************************************************************
  89. ; fast interrupt service routines
  90. ;****************************************************************************
  91.  
  92.         org     p:RESET                 ; reset isr
  93.         jmp     MAIN
  94.  
  95.         org     p:DMA0                  ; block DMA transfer finished
  96.         nop                             ; for test purposes, stop here when 
  97.         nop                             ; done
  98.  
  99. ;*****************************************************************************
  100. ;  DMA setup for DMA transfers between DSP96000 master and DSP96000 slave
  101. ;  (without semaphore control) using interrupts.
  102. ;  configure system to include:
  103. ;  1) 
  104. ;  2) all P,X,Y,I/O external acesses from port B with no wait states
  105. ;  3)      except Y:$20000000-$3FFFFFFF which is upstream DSP's aHI
  106. ;*****************************************************************************
  107.  
  108.         org     p:MAIN
  109.         movep   #$00030000,x:IPR        ; DMA channel 0 int priority level = 2
  110.         movep   #$0,x:BCRA              ; no wait states for portb P,X,Y,I/O
  111.         movep   #$0,x:BCRB              ; ...don't care about page fault
  112.         movep   #$00FFFDFF,x:PSR        ; all external fetches will be from
  113.                                         ; port B except Y:$20000000-3FFFFFFF
  114.         ori     #$8,omr                 ; enable the internal data ROMs
  115.         andi    #$CF,mr                 ; unmask all enabled interrupts
  116.  
  117. ;*****************************************************************************
  118. ;  The master verifies that the slave DMA channel 0 is free by reading
  119. ;    the DMA channel 0 control/status register.  This can be done using
  120. ;    the X memory read procedure.  If the DMA channel is dedicated to this
  121. ;    transfer, this step may be bypassed.
  122. ;*****************************************************************************
  123.  
  124. wait1   
  125.         jclr    #TRDY,y:HICSR,wait1     ; wait for TX and HRX regs to clear
  126.         movep   #DMA0CSR,y:XMR          ; read contents of slave's
  127.                                         ;   ch 0 control/status reg
  128. wait2
  129.         jset    #HMRC,y:HICSR,wait2     ; wait for contents of slave's ch 0 
  130.                                         ;   csr to be transferred to the RX reg
  131.         jset    #DE,y:RX,wait1          ; continue to wait if slave's
  132.                                         ;   DMA ch 0 is enabled
  133.  
  134. ;*****************************************************************************
  135. ;  The master initializes the slave's DMA channel using Host Command
  136. ;*****************************************************************************
  137.  
  138. wait3
  139.         jset    #HC,y:CVR,wait3         ; continue to wait if slave is
  140.                                         ;   processing a command vector
  141.         movep   #$800E,y:CVR            ; use the default host cmd. vector
  142.                                         ;   at location $1C, also set
  143.                                         ;   HC (host command) bit
  144. wait4
  145.         jset    #HC,y:CVR,wait4         ; continue to wait if slave is
  146.                                         ;   still processing DMA init
  147.                                         ;   command vector
  148. ; additional nops may be necessary
  149.          
  150. ;*****************************************************************************
  151. ;  The master initializes its own DMA channel.
  152. ;    In this example, the contents of the 512 Y data ROM are transferred
  153. ;    to the the slave address X:$1000-$13FF
  154. ;*****************************************************************************
  155.  
  156.         movep   #$400,x:DMA0SAR         ; init DMA ch 0 source address reg to
  157.                                         ;   point to beginning of Y data ROM
  158.         movep   #1,x:DMA0SOR            ; init DMA ch 0 source offset reg to
  159.                                         ;   increment by 1 through ROM
  160.         movep   #TX,x:DMA0DAR           ; init DMA ch 0 dest address reg
  161.                                         ;   to point to slave's HI TX
  162.         movep   #512,x:DMA0CR           ; transfer all 512 words from the data 
  163.                                         ;   ROM
  164.         movep   #$C4000117,x:DMA0CSR    ; enable DMA and DMA interrupt
  165.                                         ; core and channel 0 have priority
  166.                                         ; irqa is DMA request
  167.                                         ; internal Y data is source
  168.                                         ; external Y I/O is dest
  169.  
  170. ;*****************************************************************************
  171. ;  The master initializes the slave's host interface for DMA
  172. ;*****************************************************************************
  173.  
  174.         movep   #$1050,y:HICSR          ;   DMAE=1,INIT=1,TREQ=1
  175.  
  176. ;*****************************************************************************
  177. ;  main routine would go here
  178. ;*****************************************************************************
  179.  
  180.         move       #UHICSR,r4           ;load a pointer to the upstream HI
  181.         nop
  182. _l1     jclr       #RXDF,y:(r4),_l2     ;loop until Upstream guy has said
  183.                                         ;   something to us...
  184.         move       y:URX,D0.l           ;then save the word...
  185. _l2     jmp        _l1                  ;and do it again...
  186.  
  187.         end
  188.